<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
</head>
<body>
<!-- 文件上传 -->
<form  action="/springboot/png/" enctype="multipart/form-data" method="post">
    <table>
        <tr>
            <td>你的名字:</td><td><input type="text" id="StuName"></td>
            <td>上传文件:</td><td><input id="file" type="file" name="file_info"/></td><td><a onclick="fileUpload()">提交</a></td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    /*
    * 文件上传
    * 
    */
    function fileUpload() {
        alert("文件上传放开开始执行");
        var s = $('#file')[0].files[0];
        var name=$('#StuName').val();
        var temp = '{"StuName":"'+name+'"}';
        var formData = new FormData();
        formData.append("file_info", s);
        formData.append("type", temp);
        $.ajax({
            url: "/springboot/png/",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            success: function (result) {
            },
            error: function (err) {
            }
        });
    };
</script>
</body>
</html>